/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package basan.core;

import com.threed.jpct.World;

/**
 *
 * @author Menno @ Basans
 */
public class EntityManager {
    
    public static EntityManager singleton;
    private EntityContainer entityContainer;
    private EntityFactory entityFactory;
    
    private EntityManager() {
        entityFactory =  new EntityFactory();
        entityContainer = EntityContainer.getInstance();
    }
    
    public static EntityManager getInstance() {
        if(singleton != null)
            return singleton;
        return new EntityManager();
    }
    
    public void setWorld(World world) {
        entityFactory.setWorld(world);
    }
    
    public GameObject createGameObject() {
        return entityFactory.createGameObject();
    }
    
    public GameObject createGameObject(float x, float y, float z) {
        return entityFactory.createGameObject(x, y, z);
    }
    
    public GameObject createRenderableObject() {
        return entityFactory.createRenderableGameObject();
    }
    
    public GameObject createRenderableObject(float x, float y, float z) {
        return entityFactory.createRenderableGameObject(x, y, z);
    }
    
    public void updateAll() {
        entityContainer.updateAll();
    }
    
    public void thinkAll() {
        entityContainer.thinkAll();
    }
    
}
